Propagate #[allow(dead_code)] on adts to their inherent impls - #157885
Propagate #[allow(dead_code)] on adts to their inherent impls#157885mu001999 wants to merge 1 commit into
#[allow(dead_code)] on adts to their inherent impls#157885Conversation
0ff50d6 to
93cdd71
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Propagate `#[allow(dead_code)]` on adts to their inherent impls
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (25aedf1): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -2.3%, secondary -1.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 21.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 519.503s -> 518.599s (-0.17%) |
93cdd71 to
cbc2406
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Propagate `#[allow(dead_code)]` on adts to their inherent impls
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (848b0fa): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -5.4%, secondary 1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 522.035s -> 522.314s (0.05%) |
cbc2406 to
f1229af
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
37270c7 to
985dc42
Compare
This comment has been minimized.
This comment has been minimized.
…kang Refactor the `#[allow(dead_code)]` propagation for impl items of traits Extracted from #157885. This PR does the refactor and corrects the previous implementation. The following will fail currently ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=3279902b2d2e6b0fe75c5af565b1cddd)): ```rust #![deny(dead_code)] #![deny(unfulfilled_lint_expectations)] #[allow(dead_code)] pub trait Tr { fn foo(&self); } struct Foo; impl Tr for Foo { fn foo(&self) { bar(); } } #[expect(dead_code)] fn bar() {} fn main() {} ``` After this PR, we could handle the `#[allow(dead_code)]` propagation correctly, and should get perf improvement.
…kang Refactor the `#[allow(dead_code)]` propagation for impl items of traits Extracted from #157885. This PR does the refactor and corrects the previous implementation. The following will fail currently ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=3279902b2d2e6b0fe75c5af565b1cddd)): ```rust #![deny(dead_code)] #![deny(unfulfilled_lint_expectations)] #[allow(dead_code)] pub trait Tr { fn foo(&self); } struct Foo; impl Tr for Foo { fn foo(&self) { bar(); } } #[expect(dead_code)] fn bar() {} fn main() {} ``` After this PR, we could handle the `#[allow(dead_code)]` propagation correctly, and should get perf improvement.
This comment has been minimized.
This comment has been minimized.
…kang Refactor the `#[allow(dead_code)]` propagation for impl items of traits Extracted from rust-lang/rust#157885. This PR does the refactor and corrects the previous implementation. The following will fail currently ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=3279902b2d2e6b0fe75c5af565b1cddd)): ```rust #![deny(dead_code)] #![deny(unfulfilled_lint_expectations)] #[allow(dead_code)] pub trait Tr { fn foo(&self); } struct Foo; impl Tr for Foo { fn foo(&self) { bar(); } } #[expect(dead_code)] fn bar() {} fn main() {} ``` After this PR, we could handle the `#[allow(dead_code)]` propagation correctly, and should get perf improvement.
…kang Refactor the `#[allow(dead_code)]` propagation for impl items of traits Extracted from rust-lang/rust#157885. This PR does the refactor and corrects the previous implementation. The following will fail currently ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=3279902b2d2e6b0fe75c5af565b1cddd)): ```rust #![deny(dead_code)] #![deny(unfulfilled_lint_expectations)] #[allow(dead_code)] pub trait Tr { fn foo(&self); } struct Foo; impl Tr for Foo { fn foo(&self) { bar(); } } #[expect(dead_code)] fn bar() {} fn main() {} ``` After this PR, we could handle the `#[allow(dead_code)]` propagation correctly, and should get perf improvement.
…kang Refactor the `#[allow(dead_code)]` propagation for impl items of traits Extracted from rust-lang/rust#157885. This PR does the refactor and corrects the previous implementation. The following will fail currently ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=3279902b2d2e6b0fe75c5af565b1cddd)): ```rust #![deny(dead_code)] #![deny(unfulfilled_lint_expectations)] #[allow(dead_code)] pub trait Tr { fn foo(&self); } struct Foo; impl Tr for Foo { fn foo(&self) { bar(); } } #[expect(dead_code)] fn bar() {} fn main() {} ``` After this PR, we could handle the `#[allow(dead_code)]` propagation correctly, and should get perf improvement.
985dc42 to
6e7a3c2
Compare
This comment has been minimized.
This comment has been minimized.
6e7a3c2 to
13aaa5e
Compare
…r, r=chenyukang Only check `#[allow(dead_code)]` on the trait I edited on an old branch (on another machine) when trying to resolve the first comment in rust-lang#161571, and then force-pushed it. So it introduced the behavior in rust-lang#157885 partially. I found this when rebasing rust-lang#157885, and I was expecting a conflict about this. r? chenyukang
Rollup merge of #161932 - mu001999-contrib:dead-code-refactor, r=chenyukang Only check `#[allow(dead_code)]` on the trait I edited on an old branch (on another machine) when trying to resolve the first comment in #161571, and then force-pushed it. So it introduced the behavior in #157885 partially. I found this when rebasing #157885, and I was expecting a conflict about this. r? chenyukang
13aaa5e to
b67636d
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Propagate `#[allow(dead_code)]` on adts to their inherent impls
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f20aadf): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.2%, secondary -6.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.1%, secondary 4.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 481.923s -> 479.71s (-0.46%) |
View all comments
This PR does:
#[allow(dead_code)]on adts to their inherent impls and impl itemsrefactor the previous implementation for impl items of traits, and improve the performance(extracted to Refactor the#[allow(dead_code)]propagation for impl items of traits #161571 and Only check#[allow(dead_code)]on the trait #161932)After the above, there is still some slight perf regressions because we indeed do more things (for inherent impls).
Fixes #149142